export const validateNumber = (rule: any, value: any, callback: any) => {
  console.log(value);
  if (value === '' || value === undefined || value === null) {
    callback();
    return;
  }
  const reg = /^\d+(\.\d{1,2})?$/;
  if (!reg.test(value)) {
    callback(new Error('请输入数字，最多两位小数'));
  } else {
    callback();
  }
};

export const validateInteger = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined || value === null) {
    callback();
    return;
  }
  const reg = /^(0|[1-9]\d*)$/;
  if (!reg.test(value)) {
    callback(new Error('请输入正整数'));
  } else {
    callback();
  }
};
